
//@符号表示 src路径
//导入aixos对象
import request from "@/utils/request"
//登录,data对象,传后端的数据

const userpage = (data) => {
    return request({
        url: "/api/user/page",
        method: "post",
        data
    })
}

//根据id删除用户
const deleteUserById = (id) => {
    return request({
        url: `/api/user/delete/${id}`,
        method: "get"
    })
}

const findById = (id) => {
    return request({
        url: `/api/user/find/${id}`,
        method: "get"
    })
}

const save = (data) => {
    return request({
        url: "/api/user/updateUserInfo",
        method: "post",
        //表示请求的数据格式为json
        headers: { "Content-Type": "application/json;charset=utf-8" },
        data
    })
}

//根据id删除用户和作品
const deleteUserWithWorkById = (id) => {
    return request({
        url: `/api/user/deleteWithWork/${id}`,
        method: "get"
    })
}
//用户
const getAllUserList = () => {
    return request({
        url: '/api/users/find/all',
        method: 'get',
    })
}
//新增用户
const add = (data) => {
    return request({
        url: "/api/user/addUsers",
        method: "post",
        //表示请求的数据格式为json
        headers: { "Content-Type": "application/json;charset=utf-8" },
        data
    })
}
export { userpage, deleteUserById, findById, save, deleteUserWithWorkById, getAllUserList,add }
